// 2013-10-25下午02:29:45  net.betou.trade.main.dao.impl.MoveDataDaoImpl.java

package net.betou.trade.main.dao.impl;

import net.betou.common.hibernate3.HibernateBaseDao;
import net.betou.trade.entity.main.AgentAndAdmins;
import net.betou.trade.entity.main.Log;
import net.betou.trade.main.dao.MoveDataDao;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

/**
 * 
 * @author 叶装装
 */
@Repository
public class MoveDataDaoImpl extends HibernateBaseDao< Log, Integer > implements MoveDataDao{

	public int move( String entityName, AgentAndAdmins fromUser, AgentAndAdmins toUser ) {
		String hql = "update " + entityName + " bean set bean.admin.id=? where bean.admin.id=?";
		
		Query query = createQuery( hql, toUser.getId( ), fromUser.getId( ) );
		
		return query.executeUpdate( );
	}

	@Override
	protected Class< Log > getEntityClass( ) {
		return Log.class;
	}

}
